function bciLog(handle,s)    

if isempty(handle),
    fprintf('%s\n',s);
    return;
end
existingText = get(handle, 'string');
if length(existingText)>100,
    existingText=existingText{end-logBufferSize:end};
end
if isempty(existingText),
    existingText={};
end
set(handle,'string',cat(1,existingText,{sprintf(s)}));
drawnow
